export function treeToArray(list, newArr = []) {
    list.forEach(item => {
        const { children} = item
        if (children) {
            delete item.children
            if (children.length) {
                newArr.push(item)
                return treeToArray(children, newArr)
            }
        }
        newArr.push(item)
    })
    return newArr
}

